
export interface ParsingError {
    type: string
    line: number
    message: string
    file: string
}

export function formatError(err: ParsingError): string {
        return `${err.type} at ${err.file}, line ${err.line}: ${err.message}`
}

export class ParsingErrorRecorder {
    private messages: Array<ParsingError> = []

    recordSyntaxError(type: string, line: number, msg: string, file: string): undefined {
        this.messages.push({
            type: type,
            line: line,
            message: msg,
            file: file
        })
    }

    getAllMessages() {
        return this.messages
    }
}
